var express = require("express");
var path = require("path");
var http = require("http");

var app = express();

var publicPath = path.resolve(__dirname,"public");
app.use(express.static(publicPath));

app.get("/",function(request,response){
	// response.end("Welcome to my homepage!");
	response.end("your ip is "request.ip);
});

app.get("/about",function(request,response){
	response.end("This is about page!");
});

app.get("/weather",function(request,response){
	response.redirect("http://www.baidu.com");//direct go to baidu
});

app.get("/hello/:who",function(request,response){
	response.end("Hello, " + request.params.who + ".");
});


app.use(function(request,response){
	response.statusCode = 404;
	response.end("404");
});

app.listen(3000);